import api, { ListParams } from '@/service/api'
type QueryParams = Pick<
  ListParams,
  'receiverName' | 'phoneAnsweredFlag' | 'pageIndex'
>
export default function UseList() {
  // 获取业务列表
  async function getBusinessList(query: QueryParams) {
    const businessList = await api.queryP1List({
      bizType: 0,
      pageSize: 10,
      ...query,
    })
    return businessList
  }
  // 获取运维列表
  async function getMaintenanceList(query: QueryParams) {
    const maintenanceList = await api.queryP1List({
      bizType: 1,
      pageSize: 10,
      ...query,
    })
    return maintenanceList
  }
  async function getAllList(query: QueryParams) {
    return Promise.allSettled([getBusinessList(query), getMaintenanceList(query)])
  }
  return { getBusinessList, getMaintenanceList, getAllList }
}
